package org.ali.creationalpattern.singletonpattern.singletonobject;

/**
 * 登记式，懒加载，线程安全，高性能
 */
public class SingletonObject5 {
    private SingletonObject5() {
    }

    public static SingletonObject5 getInstance() {
        return SingletonHolder.OBJECT;
    }

    public void showMessage() {
        System.out.println("登记式，懒加载，线程安全，高性能");
    }

    private static class SingletonHolder {
        private static final SingletonObject5 OBJECT = new SingletonObject5();
    }
}
